.\" $Header$ -*-nroff-*-
.\" Purpose: ROFF man page for ncwa
.\" Usage:
.\" nroff -man ~/nco/man/ncwa.1 | less
.TH NCWA 1
.SH NAME
ncwa \- netCDF Weighted Averager
.SH SYNTAX
ncwa [\-3] [\-4] [\-5] [\-6] [\-7] [\-A] [\-a 
.IR dim [,...]]
[\-B 
.IR mask_cond] 
[\-b] [\-\-bfr
.IR sz_byt ] [\-C] [\-c]
[\-\-cmp
.IR cmp_sng ]
[\-\-cnk_byt
.IR sz_byt ] [\-\-cnk_csh
.IR sz_byt ] [\-\-cnk_dmn 
.IR nm,sz_lmn ]
[\-\-cnk_map 
.IR map ]
[\-\-cnk_min
.IR sz_byt ]
[\-\-cnk_plc 
.IR plc ]
[\-\-cnk_scl 
.IR sz_lmn ] [\-D
.IR dbg_lvl ]
[\-d 
.IR dim ,[
.IR min ][,[
.IR max ]]]
[\-\-dbl|flt] [-F] [--fl_fmt=fmt] [\-G
.IR gpe_dsc ]
[\-g  
.IR grp [,...]]
[\-\-gaa
.IR att_name=
.IR att_val ]]
[\-\-gad 
.IR att1 [,...]]
[\-H] [\-h] [\-\-hdf] [\-\-hdr_pad
.IR sz_byt ] [\-\-hpss_try]
[\-I] [\-L 
.IR dfl_lvl ] [\-l 
.IR path ]
[\-M 
.IR val ]
[\-m 
.IR mask ]
[\-N] [\-\-no_cll_msr] [\-\-no_cll_mth] [\-\-no_frm_trm] [\-\-no_tmp_fl] [\-O] [\-o 
.IR output-file ]
[\-p 
.IR path ]
[\-\-qnt
.IR var1 [,
.IR var2 [,...]]=
.IR prc ]]
[\-\-qnt_alg
.IR alg_nm]
[\-R] [\-r] [\-\-ram_all] [\-T
.IR mask_comp ]
[\-t
.IR thr_nbr ]
[\-\-uio] [\-\-unn] [\-v 
.IR var [,...]]
[\-w 
.IR weight ]
[\-x] [\-y 
.IR op_typ ]
.I input-file
.I output-file
.SH DESCRIPTION
.PP
.B ncwa
averages variables in a single file over arbitrary
dimensions, with options to specify weights, masks, and normalization.   
The default behavior of 
.B ncwa
is to arithmetically average every
numerical variable over all dimensions and produce a scalar result.
To average variables over only a subset of their dimensions, specify
these dimensions in a comma-separated list following 
.BR \-a ,
e.g.,
.BR "\-a time,lat,lon" .
As with all arithmetic operators, the operation may be restricted to
an arbitrary hypserslab by employing the 
.B \-d
option
.B ncwa
also handles values matching the variable's
.B _FillValue
attribute correctly. 
Moreover, 
.B ncwa
understands how to manipulate user-specified
weights, masks, and normalization options.
With these options, 
.B ncwa
can compute sophisticated averages (and
integrals) from the command line. 
.PP
.I mask
and 
.IR weight ,
if specified, are broadcast to conform to
the variables being averaged. 
The rank of variables is reduced by the number of dimensions which they
are averaged over.  
Thus arrays which are one dimensional in the 
.I input-file
and are
averaged by 
.B ncwa
appear in the 
.I output-file
as scalars.
This allows the user to infer which dimensions may have been averaged.
Note that that it is impossible for 
.B ncwa
to make make a
.I weight
or 
.I mask
of rank 
.I W
conform to a 
.I var
of
rank 
.I V
if 
.IR "W > V" .
This situation often arises when coordinate variables (which, by
definition, are one dimensional) are weighted and averaged.
.B ncwa
assumes you know this is impossible and so 
.B ncwa
does
not attempt to broadcast 
.I weight
or 
.I mask
to conform to
.I var
in this case, nor does 
.B ncwa
print a warning message
telling you this, because it is so common.  
Specifying 
.I "dbg > 2"
does cause 
.B ncwa
to emit warnings in
these situations, however.
.PP
Non-coordinate variables are always masked and weighted if specified.
Coordinate variables, however, may be treated specially.
By default, an averaged coordinate variable, e.g., 
.BR latitude ,
appears in 
.I output-file
averaged the same way as any other variable
containing an averaged dimension.
In other words, by default 
.B ncwa
weights and masks
coordinate variables like all other variables.  
This design decision was intended to be helpful but for some
applications it may be preferable not to weight or mask coordinate
variables just like all other variables.   
Consider the following arguments to 
.BR ncwa :
\(lq\-a latitude \-w
lat_wgt \-d latitude,0.,90.\(rq where 
.B lat_wgt
is a weight in the
.B latitude
dimension.
Since, by default 
.B ncwa
weights coordinate variables, the
value of 
.B latitude
in the 
.I output-file
depends on the weights 
in 
.I lat_wgt
and is not likely to be 45.---the midpoint latitude of
the hyperslab.
Option 
.B \-I
overrides this default behavior and causes 
.B ncwa
not to weight or mask coordinate variables.
In the above case, this causes the value of 
.B latitude
in the
.I output-file
to be 45.---which is a somewhat appealing result.
Thus, 
.B \-I
specifies simple arithmetic averages for the coordinate
variables. 
In the case of latitude, 
.B \-I
specifies that you prefer to archive
the central latitude of the hyperslab over which variables were averaged 
rather than the area weighted centroid of the hyperslab.
Note that the default behavior of (
.BR \-I )
changed on
1998/12/01---before this date the default was not to weight or mask
coordinate variables.
The mathematical definition of operations involving rank reduction 
is given above.

.\" NB: Append man_end.txt here
.\" $Header$ -*-nroff-*-
.\" Purpose: Trailer file for common ending to NCO man pages
.\" Usage: 
.\" Append this file to end of NCO man pages immediately after marker
.\" that says "Append man_end.txt here"
.SH AUTHOR
.B NCO
manual pages written by Charlie Zender and originally formatted by Brian Mays.

.SH "REPORTING BUGS"
Report bugs to <http://sf.net/bugs/?group_id=3331>.

.SH COPYRIGHT
Copyright \(co 1995-present Charlie Zender
.br
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

.SH "SEE ALSO"
The full documentation for
.B NCO
is maintained as a Texinfo manual called the 
.B NCO Users Guide.
Because 
.B NCO
is mathematical in nature, the documentation includes TeX-intensive
portions not viewable on character-based displays. 
Hence the only complete and authoritative versions of the 
.B NCO Users Guide 
are the PDF (recommended), DVI, and Postscript versions at
<http://nco.sf.net/nco.pdf>, <http://nco.sf.net/nco.dvi>,
and <http://nco.sf.net/nco.ps>, respectively.
HTML and XML versions
are available at <http://nco.sf.net/nco.html> and
<http://nco.sf.net/nco.xml>, respectively.

If the
.B info
and
.B NCO
programs are properly installed at your site, the command
.IP
.B info nco
.PP
should give you access to the complete manual, except for the
TeX-intensive portions.

.BR ncap2 (1), 
.BR ncatted (1), 
.BR ncbo (1), 
.BR ncclimo (1), 
.BR nces (1), 
.BR ncecat (1), 
.BR ncflint (1), 
.BR ncz2psx (1), 
.BR ncks (1), 
.BR nco (1), 
.BR ncpdq (1), 
.BR ncra (1), 
.BR ncrcat (1), 
.BR ncremap (1), 
.BR ncrename (1), 
.BR ncwa (1) 

.SH HOMEPAGE
The 
.B NCO
homepage at <http://nco.sf.net> contains more information.
